package small.common.core.util;

import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 *
 * @author jinzhou
 * @data 2023/4/17 21:55
 */
public class AopUtil {

    /**
     * 判断是否是jdk代理
     * @param object
     * @return
     */
    public static boolean isJdkDynamicProxy( Object object) {
        return (Proxy.isProxyClass(object.getClass()));
    }

    /**
     * 判断是否是cglib代理
     * @param object
     * @return
     */
    public static boolean isCglibProxy(Object object) {
        return (object.getClass().getName().contains(ClassUtil.CGLIB_CLASS_SEPARATOR));
    }

    /**
     * 判断是否是Object的Equals方法
     * @param method
     * @return
     */
    public static boolean isEqualsMethod(Method method) {
        return ReflectionUtil.isEqualsMethod(method);
    }

    /**
     * 判断是否是Object的HashCode方法
     * @see java.lang.Object#hashCode
     */
    public static boolean isHashCodeMethod(Method method) {
        return ReflectionUtil.isHashCodeMethod(method);
    }

    /**
     * 判断是否是Object的toString方法
     * @see java.lang.Object#toString()
     */
    public static boolean isToStringMethod(Method method) {
        return ReflectionUtil.isToStringMethod(method);
    }
}
